package com.cskaoyan.mall.service;

import com.cskaoyan.mall.dao.AdminDao;
import com.cskaoyan.mall.dao.AdminDaoImpl;
import com.cskaoyan.mall.model.Admin;

import java.sql.SQLException;
import java.util.List;

/**
 * @ZhidaFeng on 2020/4/30
 **/
public class AdminServiceImpl implements AdminService {
     private AdminDao adminDao =  new AdminDaoImpl();
     @Override
     public int login(Admin admin) {
        return adminDao.login(admin);
    }

    @Override
    public List<Admin> allAdmins() throws SQLException {

         return adminDao.allAdmins();
    }

    /**
     *多条件查询
     * @param params
     * @return
     */
    @Override
    public List<Admin> getSearchAdmins(Admin params) throws SQLException {
        return adminDao.getSearchAdmins(params);
    }

    @Override
    public void deleteAdmins(String id) {
        try {
            adminDao.deleteAdmins(id);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    public Admin getAdminInfo(String id) {
        return adminDao.getAdminInfo(id);
    }

    @Override
    public void updateAdminss(Admin admin) {
          adminDao.updateAdminss(admin);
    }

    @Override
    public void addAdminss(Admin admin) {
        adminDao.addAdminss(admin);
    }


}
